package p270jp.pxv.android.comment.presentation.fragment;

import android.os.Bundle;
import android.view.View;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentViewModelLazy;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import java.util.Objects;
import p064c6.Preconditions;
import p105df.FragmentCommentInputBinding;
import p189gn.AbstractC3435a;
import p189gn.AbstractC3446l;
import p216hn.Lambda;
import p216hn.PropertyReference1Impl;
import p216hn.Reflection;
import p270jp.pxv.android.R;
import p270jp.pxv.android.comment.domain.model.CommentInputState;
import p270jp.pxv.android.comment.domain.model.CommentType;
import p270jp.pxv.android.comment.presentation.flux.CommentInputActionCreator;
import p270jp.pxv.android.comment.presentation.flux.CommentInputStore;
import p270jp.pxv.android.commonUi.view.segmentedControl.PixivSegmentedLayout;
import p285kf.CommentInputAction;
import p285kf.CommentInputControlEvent;
import p293kn.Interfaces;
import p310lc.FragmentViewBinding;
import p313lf.C4672b;
import p313lf.C4673c;
import p313lf.C4674d;
import p313lf.C4675e;
import p313lf.Hilt_CommentInputFragment;
import p325m0.MutabilityOwnership;
import p350mp.Timber;
import p403on.AbstractC5469i;
import p445qf.C5830a;
import p445qf.C5831c;
import p603wm.AbstractC6949c;
import p603wm.Unit;

/* compiled from: CommentInputFragment.kt */
/* renamed from: jp.pxv.android.comment.presentation.fragment.CommentInputFragment */
/* loaded from: classes2.dex */
public final class CommentInputFragment extends Hilt_CommentInputFragment {

    /* renamed from: i */
    public static final /* synthetic */ AbstractC5469i<Object>[] f18940i;

    /* renamed from: f */
    public final Interfaces f18941f = FragmentViewBinding.m3850a(this, C4201a.f18944c);

    /* renamed from: g */
    public final AbstractC6949c f18942g = FragmentViewModelLazy.m11153c(this, Reflection.m5499a(CommentInputActionCreator.class), new C4203c(this), new C4204d(this));

    /* renamed from: h */
    public final AbstractC6949c f18943h = FragmentViewModelLazy.m11153c(this, Reflection.m5499a(CommentInputStore.class), new C4205e(this), new C4206f(this));

    /* compiled from: CommentInputFragment.kt */
    /* renamed from: jp.pxv.android.comment.presentation.fragment.CommentInputFragment$b */
    /* loaded from: classes2.dex */
    public static final class C4202b extends Lambda implements AbstractC3446l<Integer, Unit> {
        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4202b() {
            super(1);
            CommentInputFragment.this = r1;
        }

        @Override // p189gn.AbstractC3446l
        public Unit invoke(Integer num) {
            int intValue = num.intValue();
            CommentInputFragment commentInputFragment = CommentInputFragment.this;
            AbstractC5469i<Object>[] iVarArr = CommentInputFragment.f18940i;
            commentInputFragment.m4626h().f18914d.mo2437b(new CommentInputAction.C4523h(intValue));
            return Unit.f29503a;
        }
    }

    /* compiled from: FragmentViewModelLazy.kt */
    /* renamed from: jp.pxv.android.comment.presentation.fragment.CommentInputFragment$c */
    /* loaded from: classes2.dex */
    public static final class C4203c extends Lambda implements AbstractC3435a<ViewModelStore> {

        /* renamed from: a */
        public final /* synthetic */ Fragment f18946a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4203c(Fragment fragment) {
            super(0);
            this.f18946a = fragment;
        }

        @Override // p189gn.AbstractC3435a
        public ViewModelStore invoke() {
            ViewModelStore viewModelStore = this.f18946a.requireActivity().getViewModelStore();
            MutabilityOwnership.m3746l(viewModelStore, "requireActivity().viewModelStore");
            return viewModelStore;
        }
    }

    /* compiled from: FragmentViewModelLazy.kt */
    /* renamed from: jp.pxv.android.comment.presentation.fragment.CommentInputFragment$d */
    /* loaded from: classes2.dex */
    public static final class C4204d extends Lambda implements AbstractC3435a<ViewModelProvider.AbstractC0728b> {

        /* renamed from: a */
        public final /* synthetic */ Fragment f18947a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4204d(Fragment fragment) {
            super(0);
            this.f18947a = fragment;
        }

        @Override // p189gn.AbstractC3435a
        public ViewModelProvider.AbstractC0728b invoke() {
            ViewModelProvider.AbstractC0728b defaultViewModelProviderFactory = this.f18947a.requireActivity().getDefaultViewModelProviderFactory();
            MutabilityOwnership.m3746l(defaultViewModelProviderFactory, "requireActivity().defaultViewModelProviderFactory");
            return defaultViewModelProviderFactory;
        }
    }

    /* compiled from: FragmentViewModelLazy.kt */
    /* renamed from: jp.pxv.android.comment.presentation.fragment.CommentInputFragment$e */
    /* loaded from: classes2.dex */
    public static final class C4205e extends Lambda implements AbstractC3435a<ViewModelStore> {

        /* renamed from: a */
        public final /* synthetic */ Fragment f18948a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4205e(Fragment fragment) {
            super(0);
            this.f18948a = fragment;
        }

        @Override // p189gn.AbstractC3435a
        public ViewModelStore invoke() {
            ViewModelStore viewModelStore = this.f18948a.requireActivity().getViewModelStore();
            MutabilityOwnership.m3746l(viewModelStore, "requireActivity().viewModelStore");
            return viewModelStore;
        }
    }

    /* compiled from: FragmentViewModelLazy.kt */
    /* renamed from: jp.pxv.android.comment.presentation.fragment.CommentInputFragment$f */
    /* loaded from: classes2.dex */
    public static final class C4206f extends Lambda implements AbstractC3435a<ViewModelProvider.AbstractC0728b> {

        /* renamed from: a */
        public final /* synthetic */ Fragment f18949a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4206f(Fragment fragment) {
            super(0);
            this.f18949a = fragment;
        }

        @Override // p189gn.AbstractC3435a
        public ViewModelProvider.AbstractC0728b invoke() {
            ViewModelProvider.AbstractC0728b defaultViewModelProviderFactory = this.f18949a.requireActivity().getDefaultViewModelProviderFactory();
            MutabilityOwnership.m3746l(defaultViewModelProviderFactory, "requireActivity().defaultViewModelProviderFactory");
            return defaultViewModelProviderFactory;
        }
    }

    static {
        PropertyReference1Impl qVar = new PropertyReference1Impl(CommentInputFragment.class, "binding", "getBinding()Ljp/pxv/android/comment/databinding/FragmentCommentInputBinding;", 0);
        Objects.requireNonNull(Reflection.f16537a);
        f18940i = new AbstractC5469i[]{qVar};
    }

    public CommentInputFragment() {
        super(R.layout.fragment_comment_input);
    }

    /* renamed from: f */
    public static final void m4628f(CommentInputFragment commentInputFragment) {
        commentInputFragment.m4627g().f12232e.setVisibility(8);
        commentInputFragment.m4627g().f12229b.setVisibility(8);
        commentInputFragment.m4627g().f12230c.setVisibility(8);
    }

    /* renamed from: g */
    public final FragmentCommentInputBinding m4627g() {
        return (FragmentCommentInputBinding) this.f18941f.mo3849a(this, f18940i[0]);
    }

    /* renamed from: h */
    public final CommentInputActionCreator m4626h() {
        return (CommentInputActionCreator) this.f18942g.getValue();
    }

    /* renamed from: i */
    public final CommentInputStore m4625i() {
        return (CommentInputStore) this.f18943h.getValue();
    }

    @Override // androidx.fragment.app.Fragment
    public void onViewCreated(View view, Bundle bundle) {
        MutabilityOwnership.m3745m(view, "view");
        super.onViewCreated(view, bundle);
        m4627g().f12231d.setCallback(new p313lf.CommentInputFragment(this));
        LiveData<C5830a<CommentInputControlEvent>> liveData = m4625i().f18922j;
        LifecycleOwner viewLifecycleOwner = getViewLifecycleOwner();
        MutabilityOwnership.m3746l(viewLifecycleOwner, "viewLifecycleOwner");
        Preconditions.m9798T(liveData, viewLifecycleOwner, new C4672b(this));
        m4625i().f18918f.mo2788h(getViewLifecycleOwner(), new C5831c(this, 2));
        LiveData<CommentType> liveData2 = m4625i().f18923k;
        LifecycleOwner viewLifecycleOwner2 = getViewLifecycleOwner();
        MutabilityOwnership.m3746l(viewLifecycleOwner2, "viewLifecycleOwner");
        Preconditions.m9798T(liveData2, viewLifecycleOwner2, new C4675e(this));
        LiveData<CommentInputState> liveData3 = m4625i().f18924l;
        LifecycleOwner viewLifecycleOwner3 = getViewLifecycleOwner();
        MutabilityOwnership.m3746l(viewLifecycleOwner3, "viewLifecycleOwner");
        Preconditions.m9798T(liveData3, viewLifecycleOwner3, new C4673c(this));
        LiveData<Integer> liveData4 = m4625i().f18925m;
        LifecycleOwner viewLifecycleOwner4 = getViewLifecycleOwner();
        MutabilityOwnership.m3746l(viewLifecycleOwner4, "viewLifecycleOwner");
        Preconditions.m9798T(liveData4, viewLifecycleOwner4, new C4674d(this));
        Integer f = m4625i().f18925m.m11091f();
        if (f != null) {
            PixivSegmentedLayout pixivSegmentedLayout = m4627g().f12232e;
            int intValue = f.intValue();
            Objects.requireNonNull(pixivSegmentedLayout);
            try {
                View childAt = pixivSegmentedLayout.getChildAt(intValue);
                if (childAt != null) {
                    childAt.callOnClick();
                }
            } catch (Exception e) {
                Timber.f23100a.mo3514p(e);
            }
        }
        m4627g().f12232e.setOnChangeSelectItemListener(new C4202b());
    }
}
